#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
ll t;
int a[N];
ll sum[N];
ll b[N];
int c[N], num;
ll ans;
int bit[N];
int lowbit(int x) { return x & -x; }
void update(int x, int d) {
  for (int i = x; i <= num; i += lowbit(i)) bit[i] += d;
}
int query(int x) {
  int res = 0;
  for (int i = x; i > 0; i -= lowbit(i)) res += bit[i];
  return res;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> t;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, n) sum[i] = sum[i - 1] + a[i];
  rep(i, 1, n) b[i] = sum[i];
  b[n + 1] = 0;  // add zero into b
  sort(b + 1, b + n + 2);
  num = unique(b + 1, b + n + 2) - b - 1;
  rep(i, 0, n) c[i] = lower_bound(b + 1, b + num + 1, sum[i]) - b;
  update(c[0], 1);
  rep(i, 1, n) {
    ll mx = sum[i] - t;
    int id = upper_bound(b + 1, b + num + 1, mx) - b;
    ans += query(num) - query(id - 1);
    update(c[i], 1);
  }
  cout << ans;
  return 0;
}